#ifndef YCCORELOCALUSER_H
#define YCCORELOCALUSER_H
#include "user.h"
#include <QObject>

namespace yc {

class LocalUser : public User
{
    Q_OBJECT

public:
    enum LoginStatus { LOGOUT_STATUS, LOGINING_STATUS, LOGGEDIN_STATUS };

    explicit LocalUser(QObject* parent = nullptr) : User(parent) { }
    LocalUser(int id, const QString& name, QObject* parent = nullptr) : User(id, name, parent) { }

    bool offline() const { return login_status_ != LOGGEDIN_STATUS; }
    bool online() const { return login_status_ == LOGGEDIN_STATUS; }
    void changeLoginStatus(int status)
    {
        if (login_status_ != status) {
            login_status_ = status;
            Q_EMIT loginStatusChanged(status);
        }
    }

Q_SIGNALS:
    void loginStatusChanged(int status);

private:
    int login_status_ = LOGOUT_STATUS;
};

} // namespace yc

#endif // YCCORELOCALUSER_H
